package com.wxmit.module.system.web;

import com.baomidou.mybatisplus.core.metadata.IPage;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.wxmit.base.domain.ApiResult;
import com.wxmit.base.exception.BaseException;
import com.wxmit.framework.web.operatelog.Log;
import com.wxmit.framework.web.operatelog.LogModule;
import com.wxmit.framework.web.operatelog.enums.BusinessType;
import com.wxmit.base.validate.AddGroup;
import com.wxmit.base.validate.UpdateGroup;
import com.wxmit.module.system.domain.SysOperateLog;
import com.wxmit.module.system.domain.dto.SysOperateLogSearchDTO;
import com.wxmit.module.system.service.ISysOperateLogService;
import com.wxmit.system.base.core.ShushanBaseController;
import com.wxmit.system.base.domain.PageDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 操作日志记录Controller
 * @author huangxiong
 * @date 2022-08-08
 */
@RestController
@RequestMapping("/system/operateLog")
@LogModule("操作日志记录")
public class SysOperateLogController extends ShushanBaseController<ISysOperateLogService,SysOperateLog,Long>{


    public SysOperateLogController(ISysOperateLogService baseService){
        super(baseService,"system:log:");
    }

    /**
     * 查询操作日志记录列表
     */
    @SaCheckPermission("system:log:list")
    @PostMapping("/listBySearchDto")
    public ApiResult<IPage<SysOperateLog>> listPageBySearchDTO(@RequestBody PageDTO<SysOperateLogSearchDTO> pageDTO )
    {
       return ApiResult.successWithData(baseService.listPageBySearchDTO(pageDTO));
    }

    @Override
    public ApiResult<IPage<SysOperateLog>> listPage(PageDTO<SysOperateLog> pageDTO) {
        throw new BaseException("请勿调用 废弃方法！");
    }

    @SaCheckPermission("system:log:list")
    @GetMapping("/moduleList")
    public ApiResult<List<String>> moduleList()
    {
        return ApiResult.successWithData(baseService.moduleList());
    }

}